package ReaderAndWriter;

import java.io.FileWriter;
import java.io.FilterWriter;
import java.io.IOException;
import java.io.Writer;

public class TestFileWriter {
    public static void main(String[] args) {
        try {
            test();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static void test() throws IOException {
        String path = "F:\\123.txt";
        Writer writer =null;
        try {
            writer=new FileWriter(path,true);
            String str="旧铁皮往南开，恋人已不在。收听浓烟下的诗歌电台，不动情的咳嗽，至少看起来，归途也还可爱，琴弦少了姿态，再不见那夜里，听歌的小孩";
            char[] chars = str.toCharArray();
            writer.write(chars);
            writer.flush();

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (writer!=null) writer.close();
        }
    }
}
